import Layout from '@/layout/index.vue'
const routes = [
  {
    path: '/login',
    component: () => import('@/views/Login/index.vue'),
    meta: {
      title: '登录',
      requiresAuth: false, // 不需要身份验证
    },
  },
  {
    path: '/',
    component: Layout,
    redirect: 'home',
    children: [
      {
        path: 'home',
        component: () => import('@/views/Home/index.vue'),
        meta: {
          title: '首页',
          keepAlive: true,
          requiresAuth: false, // 不需要身份验证
        },
      },
      {
        path: 'my',
        component: () => import('@/views/My/index.vue'),
        meta: {
          title: '我的',
          requiresAuth: false, // 不需要身份验证
        },
      },
    ],
  },
  {
    path: '/business',
    component: () => import('@/views/business/index.vue'),
    meta: {
      title: '商家',
      requiresAuth: false, // 不需要身份验证
    },
  },
  {
    path: '/my/profile',
    component: () => import('@/views/My/profile.vue'),
    meta: {
      title: '个人资料',
      requiresAuth: true,
    },
  },
  {
    path: '/my/address',
    component: () => import('@/views/address/index.vue'),
    meta: {
      title: '收货地址',
      requiresAuth: true,
    },
  },
  {
    path: '/my/address/add',
    component: () => import('@/views/address/add.vue'),
    meta: {
      title: '添加地址',
      requiresAuth: true,
    },
  },
  {
    path: '/order/confirm',
    component: () => import('@/views/Order/confirm.vue'),
    meta: {
      title: '确认订单',
      requiresAuth: true,
    },
  },
  {
    path: '/order/list',
    component: () => import('@/views/Order/list.vue'),
    meta: {
      title: '我的订单',
      requiresAuth: true,
    },
  },
  {
    path: '/order/detail',
    component: () => import('@/views/Order/detail.vue'),
    meta: {
      title: '订单详情',
      requiresAuth: true,
    },
  },
  {
    path: '/:pathMatch(.*)*', // 使用自定义正则表达式定义通配符路由
    component: () => import('@/views/error/404.vue'),
    name: '404',
    meta: {
      title: '404',
      requiresAuth: false,
    },
  },
]
export default routes
